//
//  ViewController.m
//  轮胎商城
//
//  Created by 张晋磊 on 2017/3/21.
//  Copyright © 2017年 张晋磊. All rights reserved.
//

#import "ViewController.h"
#import "FirstViewController.h"
#import "ClassViewController.h"
#import "FindViewController.h"
#import "ShopViewController.h"
#import "MemViewController.h"

<<<<<<< HEAD
@interface ViewController ()
=======
@interface ViewController ()<UITabBarControllerDelegate>

@property (nonatomic,retain) UIButton *bt;
>>>>>>> 0294cf5077f96ee20f38631648c23fe7a1250d0b

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
<<<<<<< HEAD
    //13456780-==
=======
    
>>>>>>> 0294cf5077f96ee20f38631648c23fe7a1250d0b
    //首页
    FirstViewController *v1 = [[FirstViewController alloc]init];
    UILabel *lab = [[UILabel alloc]init];
    lab.font = [UIFont systemFontOfSize:18];
    lab.textColor = [UIColor whiteColor];
    lab.text = @"轮胎商城";
    CGSize size = [lab.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:lab.font,NSFontAttributeName, nil]];
    lab.frame = CGRectMake(0, 0, size.width, size.height);
    v1.navigationItem.titleView = lab;
    
    ClassViewController *v2 = [[ClassViewController alloc]init];
    FindViewController  *v3 = [[FindViewController alloc]init];
    ShopViewController  *v4 = [[ShopViewController alloc]init];
    MemViewController   *v5 = [[MemViewController alloc]init];
    
    
    //
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:v1];
    
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:v2];
    
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:v3];
    
    UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:v4];
    
    UINavigationController *nav5 = [[UINavigationController alloc]initWithRootViewController:v5];
    
    
    nav1.tabBarItem.title = @"首页";
    nav1.tabBarItem.image = [UIImage imageNamed:@"11"];
    
    nav2.tabBarItem.title = @"分类";
    nav2.tabBarItem.image = [UIImage imageNamed:@"qq1"];
    

    
    nav3.tabBarItem.title = @"发现";
<<<<<<< HEAD
    nav3.tabBarItem.image = [UIImage imageNamed:@"renwu"];
=======
    /*
    nav3.tabBarItem.image = [UIImage imageNamed:@"renwu"];*/
>>>>>>> 0294cf5077f96ee20f38631648c23fe7a1250d0b

    
    nav4.tabBarItem.title = @"商铺";
    nav4.tabBarItem.image = [UIImage imageNamed:@"taolun"];

    
    
    nav5.tabBarItem.title = @"会员";
    nav5.tabBarItem.image = [UIImage imageNamed:@"tonghua"];

    
    self.viewControllers = @[nav1,nav2,nav3,nav4,nav5];
    
    self.tabBar.selectedImageTintColor  = [UIColor colorWithRed:31/255.0 green:143/255.0 blue:10/255.0 alpha:1.0];
    
    [[UINavigationBar appearance]setBarTintColor:[UIColor colorWithRed:31/255.0 green:143/255.0 blue:10/255.0 alpha:1.0]];
    
<<<<<<< HEAD
=======
    [self createBt];
    
}

-(void)createBt{
    
    _bt = [UIButton buttonWithType:UIButtonTypeCustom];
    [_bt addTarget:self action:@selector(clickBt) forControlEvents:UIControlEventTouchUpInside];
    _bt.frame = CGRectMake(0, 0, 60, 60);
    _bt.layer.cornerRadius = 30;
    _bt.layer.borderWidth = 2.0;
    _bt.layer.borderColor = [UIColor whiteColor].CGColor;
    _bt.layer.masksToBounds = YES;
    _bt.backgroundColor = [UIColor colorWithRed:186/255.0 green:186/255.0 blue:186/255.0 alpha:1.0];
    [_bt setImage:[UIImage imageNamed:@"renwu"] forState:UIControlStateNormal];
    _bt.center = CGPointMake(self.tabBar.center.x, self.tabBar.center.y-20);
    [self.view addSubview:_bt];
>>>>>>> 0294cf5077f96ee20f38631648c23fe7a1250d0b
    
    
}

<<<<<<< HEAD
=======
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
    
    if(self.selectedIndex==2){
        
        _bt.selected = YES;
    }else{
        
        _bt.selected = NO;
    }
}

-(void)clickBt{
    
    self.selectedIndex = 2;
    _bt.selected = YES;
}
>>>>>>> 0294cf5077f96ee20f38631648c23fe7a1250d0b

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
